import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { inspectionPlanVO, inspectionPlanForm, inspectionPlanQuery } from '@/api/facility/inspection/inspection-plan/types';

/**
 * 查询巡检-计划列表
 * @param query
 * @returns {*}
 */

export const listinspectionPlan = (query?: inspectionPlanQuery): AxiosPromise<inspectionPlanVO[]> => {
  return request({
    url: '/inspection/inspection-plan/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询巡检-计划详细
 * @param patrolInspectionPlanId
 */
export const getinspectionPlan = (patrolInspectionPlanId: string | number): AxiosPromise<inspectionPlanVO> => {
  return request({
    url: '/inspection/inspection-plan/' + patrolInspectionPlanId,
    method: 'get'
  });
};

/**
 * 新增巡检-计划
 * @param data
 */
export const addinspectionPlan = (data: inspectionPlanForm) => {
  return request({
    url: '/inspection/inspection-plan',
    method: 'post',
    data: data
  });
};

/**
 * 修改巡检-计划
 * @param data
 */
export const updateinspectionPlan = (data: inspectionPlanForm) => {
  return request({
    url: '/inspection/inspection-plan',
    method: 'put',
    data: data
  });
};

/**
 * 删除巡检-计划
 * @param patrolInspectionPlanId
 */
export const delinspectionPlan = (patrolInspectionPlanId: string | number | Array<string | number>) => {
  return request({
    url: '/inspection/inspection-plan/' + patrolInspectionPlanId,
    method: 'delete'
  });
};
